// ignore_for_file: file_names, must_be_immutable, constant_identifier_names, slash_for_doc_comments, avoid_unnecessary_containers, prefer_const_constructors, unnecessary_cast, sized_box_for_whitespace, prefer_function_declarations_over_variables, overridden_fields, annotate_overrides, prefer_const_literals_to_create_immutables, unnecessary_null_comparison, deprecated_member_use

import 'package:mybase/base/tool/pprint/FFLog.dart';

enum EnumLifecycleState{
  enumFront,
  enumBack,
}

class FFAppLifecycleStateManager {
  // 单例公开访问点
  factory FFAppLifecycleStateManager() => _sharedInstance();

  // 静态、同步、私有访问点
  static FFAppLifecycleStateManager _sharedInstance() {
    return _instance;
  }

  // 静态私有成员，没有初始化
  static final FFAppLifecycleStateManager _instance = FFAppLifecycleStateManager._();

  // 私有构造函数
  FFAppLifecycleStateManager._() {
    // 具体初始化代码
  }

  EnumLifecycleState _state = EnumLifecycleState.enumFront;

  bool isAppFront() {
    if (_state == EnumLifecycleState.enumFront) {
      FFLog.info("app 处于前台");
      return true;
    }
    FFLog.info("app 处于后台");
    return false;
  }

  setAppFront(EnumLifecycleState s){
    FFLog.success("设置app处于 $s");
    _state = s;
  }
}
